<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/5/19
  Time: 23:56
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>添加主机</title>
</head>
<body>
<div style="border: 1px solid #E6E6E6;width: 350px;margin:auto;">
    <form id="addHostForm" style="margin-top: 20px;font-size: 15px;font-family: 微软雅黑;">
        <div style="margin-bottom:20px;text-align: center;">
            <input id="cpu_comb" name="cpu_id">
        </div>
        <div style="margin-bottom:20px;text-align: center;">
            <input id="mem_comb" name="memory_id">
        </div>
        <div style="margin-bottom:20px;text-align: center;">
            <input id="disk_comb" name="hard_disk_id">
        </div>
    </form>
    <div style="text-align:center;padding:5px 0">
        <a class="easyui-linkbutton" onclick="$('#addHostForm').form('submit');" style="width:80px">提交</a>
        <a class="easyui-linkbutton" onclick="$('#addHostForm').form('clear');" style="width:80px">重置</a>
    </div>
</div>
<script>
    $(function () {
        $('#addHostForm').form({
            url:'../host/addHost',
            type:'post',
            success:function(data){
                var data = eval('(' + data + ')');
                if (data.result === 'success') {
                    $('#addHostForm').form('clear');
                }
                $.messager.alert('提示', data.message, 'info');
            }
        });

        $('#cpu_comb').combobox({
            url:'../cpu/findCpuForComb',
            valueField:'id',
            textField:'text',
            label:'CPU',
            width:300,
            height:30,
            editable:false,
            required:true,
            missingMessage:'CPU不能为空！'
        });

        $('#mem_comb').combobox({
            url:'../memory/findMemoryForComb',
            valueField:'id',
            textField:'text',
            label:'内存',
            width:300,
            height:30,
            editable:false,
            required:true,
            missingMessage:'内存不能为空！'
        });

        $('#disk_comb').combobox({
            url:'../hardDisk/findHardDiskForComb',
            valueField:'id',
            textField:'text',
            label:'硬盘',
            width:300,
            height:30,
            editable:false,
            required:true,
            missingMessage:'硬盘不能为空！'
        });
    });
</script>
</body>
</html>
